package com.yx.pc.api.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.yx.pc.api.service.PcTdBookService;
import com.yx.system.dao.TdBookMapper;
import com.yx.system.entity.TdBook;
import com.yx.system.service.TdBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class PcTdBookServiceImpl implements PcTdBookService {

    @Autowired
    private TdBookMapper tdBookMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return tdBookMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TdBook record) {
        return tdBookMapper.insert(record);
    }

    @Override
    public int insertSelective(TdBook record) {
        return tdBookMapper.insertSelective(record);
    }

    @Override
    public TdBook selectByPrimaryKey(Integer id) {
        return tdBookMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TdBook record) {
        return tdBookMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TdBook record) {
        return tdBookMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<TdBook> queryByName(String bookName) {
        return tdBookMapper.queryByName(bookName);
    }

    @Override
    public List<TdBook> queryList(Map<String, Object> map) {
        return tdBookMapper.queryList(map);
    }

    @Override
    public Page<TdBook> queryPageList(Page<TdBook> page, Map<String, Object> map) {
        page.setRecords(tdBookMapper.queryPageList(page, map));
        return page;
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return tdBookMapper.queryTotal(map);
    }

    @Override
    public int queryTotalByClass(int classid) {
        return tdBookMapper.queryTotalByClass(classid);
    }

    @Override
    public List<TdBook> queryByTypeId(int categoryId) {
        return tdBookMapper.queryByTypeId(categoryId);
    }

    @Override
    public List<TdBook> queryByClassId(int classificationId) {
        return tdBookMapper.queryByClassId(classificationId);
    }

    @Override
    public TdBook queryByUuid(String uuid) {
        return tdBookMapper.queryByUuid(uuid);
    }

    @Override
    public List<TdBook> queryAll() {
        return tdBookMapper.queryAll();
    }

    @Override
    public List<TdBook> queryByDay() {
        return tdBookMapper.queryByDay();
    }

    @Override
    public int queryTotalByConditionId(Integer id) {
        return tdBookMapper.queryTotalBycategoryid(id);
    }

    @Override
    public List<TdBook> findByAuthorCode(String authorId) {
        return tdBookMapper.findByAuthorCode(authorId);
    }

    @Override
    public List<TdBook> findByRand() {
        return tdBookMapper.findByRand();
    }

    @Override
    public TdBook findOneByRand() {
        return tdBookMapper.findOneByRand();
    }

}
